﻿using FoodModel;
using J.FoodManageGet.Application.Command.TableNumCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace J.FoodManageGet.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TableNumController : ControllerBase
    {
        private readonly IMediator _mediator;

        public TableNumController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 桌号显示
        /// </summary>
        [HttpPost]
        public async Task<IActionResult> NumShow(TableNumShowCommand command)
        {
            var list=  await _mediator.Send(command);
            return Ok(new { 
            list.totalCount,list.PagCount,list.list
            });
        }
        /// <summary>
        /// 桌号反填
        /// </summary>
        [HttpPost]
        public async Task<TableNumModel> NumBack(TableNumBackCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 桌号ID显示
        /// </summary>
        [HttpPost]
        public async Task<List<TableNumModel>> NumIDShow(TableNumIDCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
